package com.adopapa.nezhacloud.ddd.service;

import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import org.springframework.data.jpa.domain.Specification;

import com.adopapa.nezhacloud.ddd.domain.BaseUuidEntity;

public abstract class BaseDomainService<T extends BaseUuidEntity> extends BaseService {

	public static PageRequest buildPageRequest(int pageNo, int pageSize, Order... orders) {
		return PageRequest.of(pageNo - 1, pageSize, Sort.by(orders));
	}

	public abstract Specification<T> buildSpecification(T entity);
}
